package com.xiaoyi.springboot.listener;

import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class ListenerAckFailureImpl implements ListenerAckFailure {
    private static final Logger LOGGER = LoggerFactory.getLogger(ListenerAckFailureImpl.class);

    public ListenerAckFailureImpl() {
    }

    @Override
    public void processFailure(Channel channel, Message message, String queues) {
        try {
            channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
        } catch (IOException var5) {
            LOGGER.error(message + " 删除消息失败 " + queues, var5);
        }

    }
}